<?php
	$tp = new template('views/shopping/brand.html');
	$brand = $params[0];
	extract(select('tbl_brand','url',$brand,""), EXTR_PREFIX_ALL , "b");

	$tid = strip_tags($_GET['type']);
	$type = $tid ? "AND `category_id` = ".$tid:'';
	$cnt_order = (int)count($_SESSION['p_order']);
	
	list($sql,$all_page) = splitPage("`v_product`","1 AND `brand_id` = '$b_brand_id' $type  AND `status` = '1' ORDER BY `date` DESC", 20, $_GET['p']);
	$strPage = fetchPage($all_page,$_GET['p']);
	$query = mysql_query($sql);
	$tp->block('list');
	while($result = mysql_fetch_assoc($query)) {
		$product_id	= $result['product_id'];
		$title		= $result['title'];
		$price		= $result['price'];
		$url		= $result['url'];
		$brand_url	= $result['brand_url'];
		$thumb		= $result['thumb'] ? " <img src=\"/thumb/158/100/zc/contents/product/{$result['thumb']}\" />" : '';
		$tp->apply();
	}
	mysql_free_result($query);
?>